package fr.umlv.j2ee.patterns.transfertobject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.ejb.Stateless;

import edu.emory.mathcs.backport.java.util.Collections;


@Stateless

public class BusinessObjectEJB implements BusinessObject {

	
	private HashMap<String, Account> accountMap = new HashMap<String, Account>();
	
	
	public void print(){
		System.out.println("in business object");
	}

	@Override
	public Account getAccountData(String email) {
		return accountMap.get(email);
	}

	@Override
	public void addAccount(Account acc) {
		if(accountMap.containsKey(acc.getEmail()))
			return;
		
		accountMap.put(acc.getEmail(), acc);
	}

	@Override
	public List<Account> list() {
		return new ArrayList<Account>(accountMap.values());
	}
	
	
	
}
